/**
 * 
 */
package org.swing.utility.common.thread;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

import org.swing.utility.common.exception.ThreadExecutionException;
import org.swing.utility.common.imp.IFutureResult;

/**
 * @author lqnhu
 *
 */
public class FutureResultAdapter implements IFutureResult {
	Future<?> m_future;

	public FutureResultAdapter(Future<?> future) {
		m_future = future;
	}

	public Object get() throws InterruptedException, ThreadExecutionException {
		try {
			return m_future.get();
		} catch (ExecutionException ee) {
			throw new ThreadExecutionException(ee.getCause()); // NOTE there is
																// no need to
																// keep the EE
		}
	}
}
